package com.example.xd.jetpackdemo

import android.os.Bundle
import android.util.Log
import android.view.View
import android.widget.Toast
import androidx.appcompat.app.AppCompatActivity
import androidx.databinding.DataBindingUtil.setContentView
import com.example.xd.jetpackdemo.databinding.ActivityMainBinding

const val TAG = "MainActivity"

class MainActivity : AppCompatActivity() {
    lateinit var binding: ActivityMainBinding
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        binding = setContentView(this, R.layout.activity_main)
        binding.button.setText("获取")
        binding.activity = this
    }

    override fun onStart() {
        super.onStart()
        Log.i(TAG, "onStart: ")
    }

    public fun click(v: View) {
        binding.name = binding.editTextTextPassword.text.toString()
        binding.pwd = binding.editTextTextPassword2.text.toString()
        Toast.makeText(this, binding.name + "--" + binding.pwd, Toast.LENGTH_SHORT).show()
    }

    override fun onResume() {
        super.onResume()
        Log.i(TAG, "onResume: ")
    }

    override fun onPause() {
        super.onPause()
        Log.i(TAG, "onPause: ")
    }

    override fun onStop() {
        super.onStop()
        Log.i(TAG, "onStop: ")
    }

    override fun onDestroy() {
        super.onDestroy()
        Log.i(TAG, "onDestroy: ")
    }
}
